package cn.datawin.cmppclient.sender.service;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class CacheService {

    @Resource
    private RedisTemplate redisTemplate;

    public void updateConnections(String providerNo, Integer connections) {
//        String redisKey = String.format(PROVIDER_CONNECTIONS_PREFIX, providerNo);
//
//        redisTemplate.opsForValue().set(redisKey, connections);

    }

    public void updateFailConnectCount(String providerNo, Integer count) {
//        String redisKey = String.format(PROVIDER_FAIL_CONNECT_COUNT_PREFIX, providerNo);
//
//        redisTemplate.opsForValue().set(redisKey, count);

    }

    public Integer getFailConnectCount(String providerNo) {
//        String redisKey = String.format(PROVIDER_FAIL_CONNECT_COUNT_PREFIX, providerNo);
//
//        Integer count = (Integer) redisTemplate.opsForValue().get(redisKey);
//
//        if (count == null) {
//            count = 0;
//        }
//
//        return count;
		return 0;

    }

    public void removeProviderErrorCount(String no) {
//        String redisKey = String.format(PROVIDER_ERROR_COUNT_PREFIX, no);
//        redisTemplate.delete(redisKey);
    }

//    public void pushHttpMsg(SubmitLog submitLog) {
//        String querySendKey = CmppConstant.CLIENT_QUERY_SEND_PREFIX + submitLog.getAccount();
//        redisTemplate.opsForList().rightPush(querySendKey, JSON.toJSONString(submitLog));
//    }
}
